from django.contrib import admin
from django.urls import path, include, re_path
from django.views.static import serve
from django.views.generic import TemplateView
from app01 import views
from tushu import settings

urlpatterns = [

    path('app01/', include('app01.urls')),  # 我自己取的app01中的urls
    # path('admin/', admin.site.urls),
    # path('spider/', views.spider),
    # path('demo/', views.demo),
    # path('user/', views.user),
    path('user/', include('user.urls')),  # 用户模块
    # path('user1/', include('user1.urls')),  # 用户模块
    path('menu/', include('menu.urls')),  # 权限模块
    path('role/', include('role.urls')),  # 角色模块
    # 配置媒体文件的路由地址
    re_path('media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
    # 前端入口，入口文件是 index.html
    path('', TemplateView.as_view(template_name='index.html'), name='index'),
    re_path(r'^.*/$', TemplateView.as_view(template_name='index.html')),

]

if settings.DEBUG:
    from django.conf.urls.static import static

    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS[0])
